home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11009 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: in1.uu.net!interaccess!usenet
  2. From: brianmcg@interaccess.com (Brian V. McGroarty)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: help: benchmarking
  5. Date: 21 Mar 1996 14:13:47 GMT
  6. Organization: Internet Squire
  7. Message-ID: <4iro6r$2e9@nntp.interaccess.com>
  8. References: <4io0l2$pjc@news.umbc.edu>
  9. Reply-To: brianmcg@interaccess.com
  10. NNTP-Posting-Host: d222.nhe.interaccess.com
  11. X-Newsreader: Internet Squire 1.20
  12.  
  13. Note that this information, as well as any implementation issues will be
  14. fairly topic- and system-specific.  For further discussion, you will
  15. probably get better results if you post to a newsgroup dealing with your
  16. particular computer, your operating system or operating systems in general.
  17. /* not a flame */
  18.  
  19.  
  20. The Blue Twinkie wrote:
  21. >I'm writing a program that will basicly monitor computer usage.
  22. >I need to be able to see how much the CPU is used and how much the hard
  23. >drive
  24. >is accessed.  I've seen programs that monitor these things, but I am at a
  25. >loss
  26. >when it comes to programming my own.  I can't use up too much processor
  27. >time
  28. >in running the program...  This is going on a network- I need to know how
  29. >much
  30. >a particular comupter is being accessed.  Thanks for any help!
  31.  
  32. CPU usage can be measured in several ways.  One is to attach a monitoring
  33. routine to a timer interrupt.  The routine would check what the current
  34. active task is either by viewing the kernel's task list or the location of
  35. the return pointer.  The information about the current task would be used
  36. to determine the ratio of active task hits to insignificant priority or
  37. kernel "holding area" hits.
  38.  
  39. The first option will not work with an OS which do not rely on signal
  40. semaphores to resume task execution when tasks have indicated that they
  41. "need something to continue."  For such a system, you would create a lowest
  42. priority task and determine how often it is given the chance to decline
  43. running or patch your task dispatcher to keep your statistics for you.  
  44.  
  45. As most drives are now asynchronous, you would need to actually hook or
  46. patch the file- or drive sub- system to report drive usage unless time
  47. spent waiting to serve data to drive versus amount of time spent writing is
  48. your concern, in which case you would employ a system similar to the first
  49. scheme above.
  50.  
  51.  
  52. Take care!
  53. ---
  54. Brian Valters McGroarty -- brianmcg@bix.com
  55. phone/fax (847) 439-7714
  56.